<?

include_once "index.php";

if(isset($submit) && $submit == 'Save changes')
{
	if (is_array($JobCategory2))
	{
		$JobStr = implode("," , $JobCategory2);
	}
	
	$position = strip_tags($position);
	$description = strip_tags($description);

	$q3 = "update job_post set
	position = \"$position\",
	JobCategory = \"$JobStr\", 
	short_desc = \"$s_desc\", 
	responsibilities = \"$respon\",
	requirements  = \"$require\",
	j_target = \"$careerlevel\", 
	salary = \"$salary2\", 
	s_period = \"$s_period2\"  
	where job_id = \"$job_id22\" ";
	$r3 = mysql_query($q3) or die(mysql_error());


echo "<br><br><center><span class=BlackText>The position $position was updated.</span></center>";
include_once('../footer.php');
exit;
}

$q1 = "select * from job_post where job_id = \"$_GET[job_id]\" ";
$r1 = mysql_query($q1) or die(mysql_error());
$a1 = mysql_fetch_array($r1);

?>
<br>
	<table align=center class=BlackText>
	<tr><td colspan=2 align=center class=HeaderClass> To edit a job, use the form below:</td></tr><br><br>
	<form method=post>
	<tr>
		<td align=right>Position:</td>
		<td><input type=text name=position value="<?=$a1[position]?>"></td>
	</tr>

	<tr>
		<td valign=top align=right>Job Category:</td>

	<td valign=top><?=job_categories($a1[JobCategory], "JobCategory2[]", "multiple size=5")?></td>
	</tr>

	<tr><td align=right>Short Description:</td>
		<td><textarea rows=6 cols=35 name=s_desc><?=$a1[short_desc]?></textarea></td>
	</tr>

	<tr><td align=right>Responsibilities:</td>
		<td><textarea rows=6 cols=35 name=respon><?=$a1[responsibilities]?></textarea></td>
	</tr>
	
	<tr><td align=right>Requirements:</td>
		<td><textarea rows=6 cols=35 name=require><?=$a1[requirements]?></textarea></td>
	</tr>
	
	<tr>
		<td align=right>Target: </td>
		<td><?=career_level($a1[j_target], "");?></td>
	</tr>
	
	<tr>
		<td align=right>Salary: </td>
		<td><input size=10 type=text name=salary2 value=<?=$a1[salary]?>> 
	<select name=s_period2>
<?
$sp = array('Yearly', 'Monthly');
echo "$sp[0] <br> $sp[1] <br> $sp[2]";
for($i = 0; $i <= (count($sp) - 1); $i++)
{
	if($sp[$i] == $a1[s_period])
	{
	echo "<option value=$sp[$i] selected> $sp[$i] </option>";
	}
	else
	{
	echo "<option value=$sp[$i]> $sp[$i] </option>";
	}
}
?>

	</select>
	</td></tr>

	<tr>
	<td></td>
	<td>
	<input type=hidden name=job_id22 value=<?=$_GET[job_id]?>>
	<input type=submit name=submit value="Save changes">
	</td>
	
	</tr>
</table>
</form>

<?
//}
?>
<? include_once('../footer.php'); ?>